package Simulate;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

public class Wall {

	ArrayList<Tile> wall = null;

	public void addTile(Tile tile) {
		wall.add(tile);
		Collections.shuffle(wall, new Random());
	}

	public Wall() {
		wall = new ArrayList<Tile>(136);
		for (int i = 0; i < 4; i++) {
			this.addTile(new Tile(3));
			this.addTile(new Tile(4));
			this.addTile(new Tile(6));
			this.addTile(new Tile(7));
		}
	}

	public void delTile(Tile tile) {
		wall.remove(tile);
	}

	public Tile getNextTile() {
		Tile t = wall.get(0);
		delTile(t);
		return t;
	}

	public int getSize() {
		return wall.size();
	}

	public static void main(String[] args) {
		Wall wall = null;

		int tr = 100000;
		int counter = 0;
		for (int j = 0; j < tr; j++) {
			wall = new Wall();
			int get = 0;
			int i = 0;
			Tile t = wall.getNextTile();

			if (t.val == 4 || t.val == 6) {
				
			}
				i++;
			counter += i;
		}
		double d = (double) counter / tr;
		System.out.println(d);

	}

}
